

//TODO a(35)
function a35(module, exports, a) {
    var i = a(23), s = a(3), r = a(2), n = a(21), o = function (e) {
        this.baseVideo = e
    };
    s.extend(o, i);
    var l = {
        init: function () {
            this.playerData = this.manager.playerData, this.currentTime = 0, this.seekAutoTime = null, this.baseVideo.setPreload(this.playerData.config.isPreload), r.iPhone && this.baseVideo.setIIV(), r.Notplayinline || this.baseVideo.setPlayInLine(), this.playerData.config.isAutoMute && this.baseVideo.setMute(), this.sendCVEvent = !1, this.cancellationTime = null;
            var e = ["webkitendfullscreen", "canplaythrough", "stalled", "play", "playing", "pause", "waiting", "seeking", "seeked", "progress", "canplay", "ended", "durationchange", "loadstart", "loadeddata", "loadedmetadata", "timeupdate", "error"];
            this.manager.listener.on(n.IS_AD, function (t, a) {
                a ? s.each.call(this, e, function (e, t) {
                        this.manager.evt.off(t, this.onVideoEvent, this)
                    }) : s.each.call(this, e, function (e, t) {
                        this.manager.evt.on(t, this.onVideoEvent, this)
                    })
            }, this), this.manager.listener.on(n.PLAY_STATE, this.onPlayStateChange, this)
        }, onPlayStateChange: function (e, t) {
            "init" != t && "changeDefi" != t && "stop" != t || (clearInterval(this.seekAutoTime), this.currentTime = 0)
        }, onVideoEvent: function (e) {
            var t = e.type;
            if ("progress" != t) {
                var a = "timeupdate" == t ? t + this.getCurrentTime() : t;
                this.manager.debug(a)
            }
            switch (this.baseVideo.eventPublicHandle(t), t) {
                case"durationchange":
                    this.gdur = this.getDuration(), "none" == this.manager.playerData.tryLookType && (this.manager.log.pushLog("vjs_durationChange video====" + this.gdur), this.manager.evt.trigger("vjs_durationChange", this.gdur));
                    break;
                case"webkitendfullscreen":
                    this.manager.evt.trigger("vjs_webkitendfullscreen");
                    break;
                case"canplaythrough":
                    this.manager.evt.trigger("vjs_canplaythrough");
                    break;
                case"stalled":
                    this.manager.evt.trigger("vjs_stalled");
                    break;
                case"play":
                    var i = this.manager.listener.get(n.PLAY_STATE);
                    if ("seeking" == i || "changeDefi" == i)return;
                    this.manager.evt.trigger("vjs_play");
                    break;
                case"playing":
                    this.manager.evt.trigger("vjs_playing");
                    break;
                case"pause":
                    this.manager.evt.trigger("vjs_pause");
                    break;
                case"waiting":
                    this.manager.evt.trigger("vjs_waiting");
                    break;
                case"seeking":
                    var r = this;
                    clearInterval(this.seekAutoTime), this.seekAutoTime = setInterval(function () {
                        if (Math.abs(r.currentTime - r.getCurrentTime()) > 1) {
                            if (clearInterval(r.seekAutoTime), "stop" == r.manager.listener.get(n.PLAY_STATE))return;
                            r.play(), setTimeout(function () {
                                r.manager.evt.trigger("vjs_play")
                            }, 0)
                        }
                    }, 200);
                    break;
                case"seeked":
                    break;
                case"progress":
                    this.manager.evt.trigger("vjs_progress");
                    break;
                case"canplay":
                    this.manager.evt.trigger("vjs_canplay");
                    break;
                case"ended":
                    this.manager.evt.trigger("vjs_ended");
                    break;
                case"loadstart":
                    this.manager.evt.trigger("vjs_loadstart");
                    break;
                case"loadeddata":
                    this.manager.evt.trigger("vjs_loadeddata");
                    break;
                case"loadedmetadata":
                    this.manager.evt.trigger("vjs_loadedmetadata");
                    break;
                case"timeupdate":
                    !this.sendCVEvent && this.getCurrentTime().toFixed(1) > .2 && (this.sendCVEvent = !0, this.manager.log.pushLog("vjs_sendCV"), this.manager.evt.trigger("vjs_sendCV")), this.manager.evt.trigger("vjs_timeupdate");
                    break;
                case"error":
                    s.now() - this.cancellationTime > 216e5 ? this.manager.evt.trigger("vjs_cancellation") : this.manager.evt.trigger("vjs_error")
            }
        }, setSrc: function (e) {
            this.cancellationTime = s.now(), this.baseVideo.setSrc(e), this.sendCVEvent = !1
        }, getSrc: function () {
            return this.baseVideo.getSrc()
        }, play: function () {
            this.baseVideo.play()
        }, replay: function () {
            this.baseVideo.play()
        }, pause: function () {
            this.baseVideo.pause()
        }, seek: function (e) {
            e = Math.max(e, 1), this.gdur && (e = Math.min(e, this.gdur - 5)), e = Math.round(e);
            var t = this.manager.listener.get(n.PLAY_STATE);
            return Math.abs(e - this.getCurrentTime()) <= 1 ? (this.play(), void("changeDefi" == t && this.manager.evt.trigger("vjs_play"))) : void("play" == t || "changeDefi" == t ? (this.manager.evt.one("pause", function () {
                        this.manager.evt.trigger("vjs_seeking"), this.currentTime = this.getCurrentTime(), this.baseVideo.seek(e)
                    }, this), this.pause()) : (this.manager.evt.trigger("vjs_seeking"), this.currentTime = this.getCurrentTime().toFixed(2), this.baseVideo.seek(e)))
        }, getCurrentTime: function () {
            return this.baseVideo.getCurrentTime()
        }, getBuffered: function () {
            for (var e = this.baseVideo.getBuffered(), t = this.getCurrentTime(), a = 0, i = e.length; a < i; a++)if (e[a].end - t >= 0)return e[a].end
        }, getDuration: function () {
            var e = this.baseVideo.getDuration();
            return isFinite(e) ? e : this.manager.playerData.vinfo.gdur
        }, release: function () {
        }, changeFullScreen: function (e) {
            this.baseVideo.changeFullScreen(e)
        }
    };
    s.merge(o.prototype, l), module.exports = o
}

